import { Component, OnInit } from '@angular/core';
import {Path} from "../../../../portal/admin/admin-breadcrumb/breadcrumb";
import {PageSubject} from "../../../../util/page-subject";
import {Start} from "./start";
import {StartService} from "./start.service";
import {OneDialogService} from "../../../../widgets/one-dialog/one-dialog.service";
import {ResponseUtil} from "../../../../util/response-util";
import {MsgConstants} from "../../../../constants/constants";
import {MsgResult} from "../../../../models/msg-result";

declare var $;
declare var moment;
declare var echarts;

@Component({
  selector: 'app-start',
  templateUrl: './start.component.html',
  styleUrls: ['./start.component.css']
})
export class StartComponent implements OnInit {
  /**
   * 声明实例
   */
  start:Start;
  fineLine;lightLine;mediumLine;


  constructor(
    private pageSubject : PageSubject,
    private StartService : StartService,
    private responseUtil :ResponseUtil,
    private dialogService: OneDialogService,
  ) {
    this.initObject();
  }

  ngOnInit() {
    this.pushPage();
    this.realWeatherData();
    this.waterForecastData();
    this.realAQIData();
    this.countAQIData();
    this.targetChartData();
    this.cityDataChart();
    this.initEvent();
    this.rankingTable();
  }

  /**
   * 面包屑导航
   */
  pushPage() {
    let path = new Path("总览", "");
    this.pageSubject.pushPage("全局总览", "", path);
  }

  /**
   * 实例化对象
   */
  private initObject() {
    this.start = new Start();
    this.start.regionName = "";
    this.start.monitorTime =  moment().subtract(1,"h").format("YYYY-MM-DD HH")+":00:00";
    this.start.temperature = "";
    this.start.humidity = "";
    this.start.windDirect = "";
    this.start.windSpeed = "";
    this.start.pm25 = "";
    this.start.pm10 = "";
    this.start.so2 = "";
    this.start.no2 = "";
    this.start.co = "";
    this.start.o3 = "";
    this.start.weatherList = "";
    this.start.realWeatherMessage = "";
    this.start.weatherList = "";
  }

//实时天气
  realWeatherData(){
    this.StartService.getRealWeatherData().subscribe(
      result => this.responseUtil.success(result,this.getRealWeatherDataResult),
      message => this.responseUtil.error(message)
    );
  }
  private getRealWeatherDataResult = (result: MsgResult) =>{
    if (result && result.code == MsgConstants.MSG_CODE_OK) {
      this.getRealWeatherDataTree(result.data);
    }
    if (result && result.code != MsgConstants.MSG_CODE_OK) {
      this.dialogService.info(result.message);
    }
  }
  getRealWeatherDataTree = (data) =>{
    this.start.temperature = data.temperature || "-";
    this.start.humidity = data.humidity || "-";
    this.start.windDirect = data.windDirect || "-";
    this.start.windSpeed = data.windSpeed || "-";
  }

  //天气预报
  waterForecastData(){
    this.StartService.getWaterForecastData().subscribe(
      result => this.responseUtil.success(result,this.getWaterForecastDataResult),
      message => this.responseUtil.error(message)
    );
  }
  private getWaterForecastDataResult = (result: MsgResult) =>{
    if (result && result.code == MsgConstants.MSG_CODE_OK) {
      this.getWaterForecastDataTree(result.data);
    }
    if (result && result.code != MsgConstants.MSG_CODE_OK) {
      this.dialogService.info(result.message);
    }
  }
  getWaterForecastDataTree = (data) =>{
     this.start.weatherList = [];
    $.each(data.forecast,function(i,data){
      if(i<5){
        data.imgClass = "one-weather-";
        data.imgClass  += data.cond.cond_d == "多云"?"cloudy"
          :data.cond.cond_d == "阴"?"overcast"
            :data.cond.cond_d.indexOf("雾")!=-1?"fog"
              :data.cond.cond_d.indexOf("晴")!=-1?"sunny"
                :data.cond.cond_d.indexOf("雨")!=-1?"rain"
                  :data.cond.cond_d.indexOf("雪")!=-1?"snow":"";
        let day = new Date(data.date).getDay();
        let dayObj = day==1?"(周一)":day==2?"(周二)":day==3?"(周三)":day==4?"(周四)":day==5?"(周五)":day==6?"(周六)":day==0?"(周日)":"()";
        var time = i==0?"(今天)":i==1?"(明天)":i==2?"(后天)":dayObj;
        var weatherDay = parseInt(data.date.split("-")[2]);
        data.date = weatherDay +"号"+time;
        this.start.weatherList.push(data);
      }
    }.bind(this));
    console.log(this.start.weatherList)
    console.log(1)
  }

  //实时AQI
  realAQIData(){
    this.StartService.getRealAQIData().subscribe(
      result => this.responseUtil.success(result,this.getRealAQIDataResult),
      message => this.responseUtil.error(message)
    );
  }
  private getRealAQIDataResult = (result: MsgResult) =>{
    if (result && result.code == MsgConstants.MSG_CODE_OK) {
      this.getRealAQIDataTree(result.data);
    }
    if (result && result.code != MsgConstants.MSG_CODE_OK) {
      this.dialogService.info(result.message);
    }
  }
  getRealAQIDataTree = (data) =>{
    this.dayAQI(data.aqi);
    this.start.regionName = data.regionName;
    this.start.pm25Level = this.aqiLevel(data.pm25IAQI);
    this.start.pm10Level = this.aqiLevel(data.pm10IAQI);
    this.start.so2Level = this.aqiLevel(data.so2IAQI);
    this.start.coLevel = this.aqiLevel(data.coIAQI);
    this.start.no2Level = this.aqiLevel(data.no2IAQI);
    this.start.o3Level = this.aqiLevel(data.o3IAQI);
    this.start.pm25 = data.pm25;
    this.start.pm10 = data.pm10;
    this.start.so2 = data.so2;
    this.start.no2 = data.no2;
    this.start.co = data.co;
    this.start.o3 = data.o3;
    var firstPollutant = data.pollutant.indexOf("PM10")!=-1?".one-AQI-PM10":data.pollutant.indexOf("PM2")!=-1?".one-AQI-PM25":data.pollutant.indexOf("SO2")!=-1?".one-AQI-SO2":data.pollutant.indexOf("NO2")!=-1?".one-AQI-NO2":data.pollutant.indexOf("CO")!=-1?".one-AQI-CO":data.pollutant.indexOf("O3")!=-1?".one-AQI-O3":" ";
    $(firstPollutant).addClass("one-pollute-first");

  }




//当日累计AQI
  countAQIData(){
    this.StartService.getCountAQIData().subscribe(
      result => this.responseUtil.success(result,this.getCountAQIDataResult),
      message => this.responseUtil.error(message)
    );
  }
  private getCountAQIDataResult = (result: MsgResult) =>{
    if (result && result.code == MsgConstants.MSG_CODE_OK) {
      this.getCountAQIDataTree(result.data);
    }
    if (result && result.code != MsgConstants.MSG_CODE_OK) {
      this.dialogService.info(result.message);
    }
  }
 getCountAQIDataTree = (data) =>{
   this.AQICount(data);
  }

//年度目标
  targetChartData(){
    this.StartService.getTargetChartData().subscribe(
      result => this.responseUtil.success(result,this.getTargetChartDataResult),
      message => this.responseUtil.error(message)
    );
  }
  private getTargetChartDataResult = (result: MsgResult) =>{
    if (result && result.code == MsgConstants.MSG_CODE_OK) {
      this.getTargetChartDataTree(result.data);
    }
    if (result && result.code != MsgConstants.MSG_CODE_OK) {
      this.dialogService.info(result.message);
    }
  }
  getTargetChartDataTree = (data) =>{
    this.targetGoal(data.yearGoalData.yFineDays);
    this.start.pm10GoalDone = data.yearGoalData.yPM10.done || "-";
    this.start.pm10GoalGoal = data.yearGoalData.yPM10.goal || "-";
    this.start.pm25GoalDone = data.yearGoalData.yPM25.done || "-";
    this.start.pm25GoalGoal = data.yearGoalData.yPM25.goal || "-";

    let mPM10 = this.compareData(this.start.pm10GoalDone,this.start.pm10GoalGoal);
    this.start.pm10GoalClassName = mPM10[0];
    this.start.pm10GoalDoneHeight = mPM10[1];
    this.start.pm10GoalGoalHeight = mPM10[2];

    let mPM25 = this.compareData(this.start.pm25GoalDone,this.start.pm25GoalGoal);
    this.start.pm25GoalClassName = mPM10[0];
    this.start.pm25GoalDoneHeight = mPM10[1];
    this.start.pm25GoalGoalHeight = mPM10[2];

  }
  compareData = (data1,data2) =>{
    let dataClass = " ";
    let doneHeight = " ";
    let goalHeight = " ";
    if(data1>data2){
      dataClass ="one-progress-bar-now-bed";
      doneHeight = "70%";
      goalHeight = data2/data1*70+"%";
    }else{
      dataClass ="one-progress-bar-now-good";
      doneHeight = data1/data2*70+"%";
      goalHeight = "70%";
    }
    return [dataClass,doneHeight,goalHeight];
  }

  //当日累计综合指数
  cityDataChart(){
    this.StartService.getCityDataChart().subscribe(
      result => this.responseUtil.success(result,this.getCityDataChartResult),
      message => this.responseUtil.error(message)
    );
  }
  private getCityDataChartResult = (result: MsgResult) =>{
    if (result && result.code == MsgConstants.MSG_CODE_OK) {
      this.getCityDataChartTree(result.data);
    }
    if (result && result.code != MsgConstants.MSG_CODE_OK) {
      this.dialogService.info(result.message);
    }
  }
  private getCityDataChartTree(data){
      this.ranking(data);
  }

  //排名表格
  rankingTable(){
    this.StartService.getRankingTable().subscribe(
      result => this.responseUtil.success(result,this.getRankingTableResult),
      message => this.responseUtil.error(message)
    );
  }
  private getRankingTableResult = (result: MsgResult) =>{
    if (result && result.code == MsgConstants.MSG_CODE_OK) {
      this.getRankingTableTree(result.data);
    }
    if (result && result.code != MsgConstants.MSG_CODE_OK) {
      this.dialogService.info(result.message);
    }
  }
  private getRankingTableTree(data){
    if(data == null){
      $(".pieChartContainer").find("[id$=Chart]").html("暂无数据");
    }else{
      var btnHtml = '';
      $.each(data.nameList,function(i,name){
        btnHtml += '<div class="btn btn-default" data-index="'+i+'">'+name+'</div>';
      });
      $(".rankingTableBtn").html(btnHtml);
      $(".rankingTableBtn .btn:first-child").addClass("active");
      this.rankingTableHtml(data,0);
      $(".rankingTableBtn").on("click",".btn",function(e){
        var index = $(e.target).data("index");
        this.rankingTableHtml(data,index);
      }.bind(this))
    }
  }



//点击样式
  initEvent(){
    //当日累计综合指数的点击效果
    $(".chart-btn .btn-group").on("click",".btn",function(){
      var id =$(this).data("type");
      $("#"+id).show().siblings().hide();
    });

    // 按钮点击事件
    $(".btn-group").on("click",".btn",function(){
      $(this).addClass("active").siblings(".active").removeClass("active");
    });

    //改变input样式
    $('input').iCheck({
      checkboxClass: 'icheckbox_minimal-green',
      radioClass: 'iradio_minimal-green',
      increaseArea: '20%' // optional
    });  }





  //当日AQI
  dayAQI(AQI){

  var AQIOption = {
    title:{
      text:"AQI",
      right:"38%",
      bottom:"20%",
      textStyle:{
        color:"#fff",
        fontSize:14,
        fontWeight:"normal"
      }
    },
    series: [{
      type: 'liquidFill',
      animation: true,
      waveAnimation: true,
      data: [0.75, 0.70],
      color: [this.weakColor(AQI), this.aqiColor(AQI)],
      amplitude: 8,
      radius: '90%',
      label: {
        normal: {
          formatter: function() {
            return AQI;
          },
          textStyle: {
            fontSize: 48,
            color: '#fff',
            fontWeight:"normal"
          },
          position: ['50%', '50%']
        }
      },
      outline: {
        itemStyle: {
          borderColor: '#aaa4a4',
          borderWidth: 1,
          color: 'none',
          shadowBlur: 0,
          shadowColor: "#fff"
        },
        borderDistance: 0
      },
      itemStyle: {
        normal: {
          backgroundColor: '#fff',
          shadowBlur: 0,
          shadowColor: "#fff"
        }
      },
      backgroundStyle: {
        color: '#fff'
      }
    }]
  };
  var dayAQIChart = echarts.init(document.getElementById('dayAQIChart'));
  dayAQIChart.setOption(AQIOption);
}

  //污染物等级颜色
  aqiColor(aqi){
  var color = aqi>0&&aqi<=50?"#61D800"
    :aqi>50&&aqi<=100?"#CCB21A"
      :aqi>100&&aqi<=150?"#F5A623"
        :aqi>150&&aqi<=200?"#F12F1C"
          :aqi>200&&aqi<=300?"#9C0D71"
            :aqi>300?"#630445":"#fff";
  return color;
}

  //实时AQI波浪的另一个颜色
  weakColor(aqi){
  var color = aqi>0&&aqi<=50?"rgba(97,216,0,.7)"
    :aqi>50&&aqi<=100?"rgba(204,178,26,.7)"
      :aqi>100&&aqi<=150?"rgba(245,166,35,.7)"
        :aqi>150&&aqi<=200?"rgba(241,47,28,.7)"
          :aqi>200&&aqi<=300?"rgba(156,13,113,.7)"
            :aqi>300?"rgba(99,4,69,.7)":"#C7C7CB";
  return color;
}

  // 污染等级
  aqiLevel(data) {
    var level = data>=0&&data<=50?"1"
      :data>50&&data<=100?"2"
        :data>100&&data<=150?"3"
          :data>150&&data<=200?"4"
            :data>200&&data<=300?"5"
              :data>300?"6":"";
    return level;
  }

  //当日累计AQI
  AQICount(dataList){
    let hours=moment().format("HH");
  var color;
  var colorGradient = [];
  $.each(dataList[0],function(i,data){
    if(i>parseInt(hours)){
      return false;
    }
    if(data != "-"){
      var colorObj = {
        offset: i/parseInt(hours), color:this.aqiColor(data)
      };
      colorGradient.push(colorObj);
    }
    if(colorGradient.length == 0){
      color = "#fff";
    }else{
      color = new echarts.graphic.LinearGradient(0, 0, 1, 0,colorGradient , false);
    }
  }.bind(this));
  var dayCountAQI  = {
    tooltip : {
      trigger: 'axis',
      formatter:function(params,ticket,callback){
        params[1].value = params[1].value?params[1].value:"-";
        params[0].value = params[0].value?params[0].value:"-";
        return params[0].name+"时 </br>"+params[0].seriesName+":"+params[0].value;
        /*+" </br>"+params[1].seriesName+":"+params[1].value*/ /*预计AQI悬停数据*/
      }
    },
    legend: {
      data:[],
      selectedMode:false
    },
    grid: {
      left: '30',
      right: '20',
      top: '25',
      bottom:"25"
    },
    xAxis : [
      {
        type : 'category',
        boundaryGap : false,
        data : dataList[2]
      }
    ],
    yAxis : [
      {
        type : 'value'
      }
    ],
    series : [
      // {
      //     name:'预计AQI',
      //     type:'line',
      //     lineStyle:{
      //         normal:{
      //             type:"dashed",
      //             color:"#aaa4a4"
      //         }
      //     },
      //     smooth:true,
      //     smoothMonotone:'y',
      //     symbol: 'none',
      //     data:dataList[1]
      // },
      {
        name:'当前AQI',
        type:'line',
        lineStyle:{
          normal:{
            width:0,
            type:"dashed",
            color:"#aaa4a4"
          }
        },
        symbol: 'none',
        zlevel:2,
        areaStyle: {
          normal: {
            color: color
          }
        },
        data:dataList[0]
      }
    ]
  };
  var realData = [];
  $.each(dataList[0],function(i,real){
    if(real!="-"){
      realData.push(real);
    }
  });
  var realMaxNum = Math.max.apply(Math, realData);
  var predictMaxNum = Math.max.apply(Math, dataList[1]);
  var maxNum =  realMaxNum>predictMaxNum?realMaxNum:predictMaxNum;
    this.fineLine = {
    name:'良',
    type:'line',
    itemStyle:{
      normal:{
        color:"#CCB21A"
      }
    },
    symbol: 'none',
    data:[100, 100, 100, 100, 100, 100, 100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100]
  };
    this.lightLine =  {
    name:'轻度污染',
    type:'line',
    itemStyle:{
      normal:{
        color:"#F5A623"
      }
    },
    symbol: 'none',
    data:[150, 150, 150, 150, 150, 150, 150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150]
  };
    this.mediumLine = {
    name:'中度污染',
    type:'line',
    itemStyle:{
      normal:{
        color:"#FF331E"
      }
    },
    symbol: 'none',
    data:[200, 200, 200, 200, 200, 200, 200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200]
  };
  (maxNum>50) && dayCountAQI.series.push(this.fineLine) && dayCountAQI.legend.data.push("良");
  (maxNum>100) && dayCountAQI.series.push(this.lightLine) && dayCountAQI.legend.data.push("轻度污染");
  (maxNum>150) && dayCountAQI.series.push(this.mediumLine) && dayCountAQI.legend.data.push("中度污染");
  var dayCountAQIChart = echarts.init(document.getElementById('conutAQIChart'));
  dayCountAQIChart.setOption(dayCountAQI);
}

//年度考核目标
  targetGoal(fineDay){
  var title = fineDay.done+"/"+fineDay.goal;
  var daysInYear = moment(moment().format("YYYY")).isLeapYear()?366:365;
  var targetOption = {
    tooltip : {
      formatter: "{a} <br/>{b} <br/> 已过{c}天"
    },
    title:{
      text:"优良天数",
      textAlign:"center",
      top:"bottom",
      right:30,
      textStyle:{
        fontWeight:"normal",
        fontSize:"14",
        fontFamily:"微软雅黑",
        color:"#333"
      }
    },
    series: [
      {
        name: '优良天数',
        type: 'gauge',
        z: 3,
        min: 0,
        max: fineDay.goal,
        startAngle:240,
        endAngle:-60,
        splitNumber: 1,
        radius: '90%',
        axisLine: {            // 坐标轴线
          lineStyle: {       // 属性lineStyle控制线条样式
            width: 16,
            color:[[fineDay.done/fineDay.goal,"#D2D3D2"],[1,"#82CAAE"]]
          }
        },
        silent:true,
        pointer:{
          width:4
        },
        axisTick: {            // 坐标轴小标记
          splitNumber:12,
          length:16
        },
        splitLine: {
          length:16
        },
        axisLabel: {
          distance:1,
          textStyle:{
            color:"#82CAAE"
          }
        },
        detail : {
          formatter: function (value) {
            return "还有"+(daysInYear-moment().dayOfYear())+"天";
          },
          textStyle:{
            color:"#333",
            fontSize:12
          }
        },
        itemStyle:{
          normal:{
            color:"#82CAAE"
          }
        },
        title : {
          offsetCenter:[0,"5%"],
          textStyle: {
            fontWeight: 'bolder',
            fontSize: 20
          }
        },
        data:[{value:fineDay.done,name:title}]
      }
    ]
  };
  var targetChart = echarts.init(document.getElementById('annualTargetChart'));
  targetChart.setOption(targetOption);
}

  //当日累计综合指数
  ranking(chartList){
  if(chartList.cityData!=null && chartList.cityData.dataList.length!=0 && chartList.tabName.length!=0){
    $(".chart-btn").find(".btn-group").append('<div class="btn btn-default" data-type="cityDataChart">'+chartList.tabName.cityName+'</div>');
    var cityDataChart = echarts.init(document.getElementById('cityDataChart'));
    var cityDataOption = {
      tooltip : {
        trigger: 'axis',
        formatter:function(params,ticket,callback){
          if(params.length>1){
            params[0].value = params[0].value?params[0].value:"-";
            return params[0].name+"</br>"+params[0].seriesName+":"+params[0].value;
          }
        }
      },
      legend: {
        data:["市综合指数"],
        selectedMode:false
      },
      xAxis: {
        type: 'category',
        nameGap:"20",
        nameLocation:"start",
        splitLine: {
          show: false
        },
        axisTick: {
          alignWithLabel:true
        },
        boundaryGap:["10%","10%"],
        data: chartList.cityData.nameList
      },
      yAxis: {
        type: 'value',
        splitLine: {
          show: false
        }
      },
      series: [
        {
          name: '综合指数',
          type: 'bar',
          smooth: true,
          symbolSize:6,
          barWidth:"20",
          label:{
            normal:{
              show:true,
              position:"top"
            }
          },
          // data: [167, 158, 155, 142, 132, 130, 120,111],
          data:[],
          markLine: {
            symbol:"none",
            silent:true,
            data: [
              {
                name: '区综合指数',
                yAxis: chartList.cityData.dataAVG,
                itemStyle:{
                  normal:{
                    color:"#48ab5d"
                  }
                },
                symbol:"none",
                lineStyle:{
                  normal:{
                    width:2,
                    type:"solid"
                  }
                }
              }
            ]
          }
        },
        {
          name: '市综合指数',
          type: 'line',
          smooth: true,
          symbol: 'none',
          data:[],
          itemStyle:{
            normal:{
              color:"#48ab5d"
            }
          }
        }
      ]
    };
    $.each(chartList.cityData.dataList,function(i,data){
      var dataColor = "";
      dataColor = data<=chartList.cityData.dataAVG?"#48AB5D":"#C23531";
      var rankingData = {
        value:data,
        itemStyle:{
          normal:{
            color:dataColor
          }
        }
      };
      cityDataOption.series[0].data.push(rankingData);
    });
    cityDataChart.setOption(cityDataOption);
  }
  if(chartList.outskirtsData!=null && chartList.outskirtsData.dataList.length!=0){
    $(".chart-btn").find(".btn-group").append('<div class="btn btn-default" data-type="outskirtsDataChart">'+chartList.tabName.outskirtsName+'</div>');
    var outskirtsDataChart = echarts.init(document.getElementById('outskirtsDataChart'));
    var outskirtsDataOption = {
      tooltip : {
        trigger: 'axis',
        formatter:function(params,ticket,callback){
          if(params.length>1){
            params[0].value = params[0].value?params[0].value:"-";
            return params[0].name+"</br>"+params[0].seriesName+":"+params[0].value;
          }
        }
      },
      legend: {
        data:["市综合指数"],
        selectedMode:false
      },
      xAxis: {
        type: 'category',
        nameGap:"20",
        nameLocation:"start",
        splitLine: {
          show: false
        },
        axisTick: {
          alignWithLabel:true
        },
        boundaryGap:["10%","10%"],
        data: chartList.outskirtsData.nameList
      },
      yAxis: {
        type: 'value',
        splitLine: {
          show: false
        }
      },
      series: [
        {
          name: '综合指数',
          type: 'bar',
          smooth: true,
          symbolSize:6,
          barWidth:"20",
          label:{
            normal:{
              show:true,
              position:"top"
            }
          },
          // data: [167, 158, 155, 142, 132, 130, 120,111],
          data:[],
          markLine: {
            symbol:"none",
            silent:true,
            data: [
              {
                name: '郊县综合指数',
                yAxis: chartList.outskirtsData.dataAVG,
                itemStyle:{
                  normal:{
                    color:"#48ab5d"
                  }
                },
                lineStyle:{
                  normal:{
                    width:2,
                    type:"solid"
                  }
                }
              }
            ]
          }
        },
        {
          name: '市综合指数',
          type: 'line',
          smooth: true,
          symbol: 'none',
          data:[],
          itemStyle:{
            normal:{
              color:"#48ab5d"
            }
          }
        }
      ]
    };
    $.each(chartList.outskirtsData.dataList,function(i,data){
      var dataColor = "";
      dataColor = data<=chartList.outskirtsData.dataAVG?"#48AB5D":"#C23531";
      var rankingData = {
        value:data,
        itemStyle:{
          normal:{
            color:dataColor
          }
        }
      };
      outskirtsDataOption.series[0].data.push(rankingData);
    });
    outskirtsDataChart.setOption(outskirtsDataOption);
  }
  $("#cityDataChart").parent().parent().find(".btn-group :first-child").addClass("active");
  $(".one-chart-container :first-child").show().siblings().hide();
}

  //排名表格
 rankingTableHtml(rankingTableData,index){
  var initChangeHtml = "";
  var initRankingHtml = '';
  if(rankingTableData.changeList[index] != null){
    var changeData = rankingTableData.changeList[index];
    initChangeHtml += '<li class="text-center"> <div class="one-index">综合指数</div></li><li class="text-center">'+changeData.dayChange.change+'/'+changeData.dayChange.count+'</li><li class="text-center">'+changeData.monthChange.change+'/'+changeData.monthChange.count+'</li><li class="text-center">'+changeData.yearChange.change+'/'+changeData.yearChange.count+'</li>';
    $(".changeData").html(initChangeHtml)
  }
  if(rankingTableData.rankList[index] != null){
    var rankingData = rankingTableData.rankList[index];
    initRankingHtml += '<li class="text-center"> <div class="one-change">变化程度</div></li><li class="text-center">'+rankingData.dayRank.rank+'/'+rankingData.dayRank.count+'</li><li class="text-center">'+rankingData.monthRank.rank+'/'+rankingData.monthRank.count+'</li><li class="text-center">'+rankingData.yearRank.rank+'/'+rankingData.yearRank.count+'</li>';
    $(".rankingData").html(initRankingHtml)
  }
}
}
